3957
|
1 |
/*
|
|
2 |
* CDDL HEADER START
|
|
3 |
*
|
|
4 |
* The contents of this file are subject to the terms of the
|
|
5 |
* Common Development and Distribution License (the "License").
|
|
6 |
* You may not use this file except in compliance with the License.
|
|
7 |
*
|
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
9 |
* or http://www.opensolaris.org/os/licensing.
|
|
10 |
* See the License for the specific language governing permissions
|
|
11 |
* and limitations under the License.
|
|
12 |
*
|
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each
|
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
15 |
* If applicable, add the following below this CDDL HEADER, with the
|
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying
|
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner]
|
|
18 |
*
|
|
19 |
* CDDL HEADER END
|
|
20 |
*/
|
|
21 |
/*
|
|
22 |
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
|
23 |
* Use is subject to license terms.
|
|
24 |
*/
|
|
25 |
|
|
26 |
#pragma ident "%Z%%M% %I% %E% SMI"
|
|
27 |
|
|
28 |
#pragma weak sharefs = _sharefs
|
|
29 |
|
|
30 |
#include "synonyms.h"
|
|
31 |
#include <sys/types.h>
|
|
32 |
#include <sys/types32.h>
|
|
33 |
#include <rpc/types.h>
|
|
34 |
#include <sys/vfs.h>
|
|
35 |
#include <strings.h>
|
|
36 |
#include <sharefs/share.h>
|
|
37 |
#include <sys/syscall.h>
|
|
38 |
|
|
39 |
#include "libc.h"
|
|
40 |
|
|
41 |
#define SMAX(i, j) \
|
|
42 |
if ((j) > (i)) { \
|
|
43 |
(i) = (j); \
|
|
44 |
}
|
|
45 |
|
|
46 |
int
|
|
47 |
sharefs(enum sharefs_sys_op opcode, struct share *sh)
|
|
48 |
{
|
|
49 |
uint32_t i, j;
|
|
50 |
|
|
51 |
/*
|
|
52 |
* We need to know the total size of the share
|
|
53 |
* and also the largest element size. This is to
|
|
54 |
* get enough buffer space to transfer from
|
|
55 |
* userland to kernel.
|
|
56 |
*/
|
|
57 |
i = (sh->sh_path ? strlen(sh->sh_path) : 0);
|
|
58 |
sh->sh_size = i;
|
|
59 |
|
|
60 |
j = (sh->sh_res ? strlen(sh->sh_res) : 0);
|
|
61 |
sh->sh_size += j;
|
|
62 |
SMAX(i, j);
|
|
63 |
|
|
64 |
j = (sh->sh_fstype ? strlen(sh->sh_fstype) : 0);
|
|
65 |
sh->sh_size += j;
|
|
66 |
SMAX(i, j);
|
|
67 |
|
|
68 |
j = (sh->sh_opts ? strlen(sh->sh_opts) : 0);
|
|
69 |
sh->sh_size += j;
|
|
70 |
SMAX(i, j);
|
|
71 |
|
|
72 |
j = (sh->sh_descr ? strlen(sh->sh_descr) : 0);
|
|
73 |
sh->sh_size += j;
|
|
74 |
SMAX(i, j);
|
|
75 |
|
|
76 |
return (syscall(SYS_sharefs, opcode, sh, i));
|
|
77 |
}
|