modules/vfs_gpfs.c

説明を見る。
00001 /*
00002    Unix SMB/CIFS implementation.
00003    Wrap gpfs calls in vfs functions.
00004  
00005    Copyright (C) Christian Ambach <cambach1@de.ibm.com> 2006
00006    
00007    Major code contributions by Chetan Shringarpure <chetan.sh@in.ibm.com>
00008                             and Gomati Mohanan <gomati.mohanan@in.ibm.com>
00009    
00010    This program is free software; you can redistribute it and/or modify
00011    it under the terms of the GNU General Public License as published by
00012    the Free Software Foundation; either version 2 of the License, or
00013    (at your option) any later version.
00014    
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019    
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023   
00024 
00025 */
00026 
00027 #include "includes.h"
00028 
00029 #undef DBGC_CLASS
00030 #define DBGC_CLASS DBGC_VFS
00031 
00032 #include <gpfs_gpl.h>
00033 #include "nfs4_acls.h"
00034 
00035 
00036 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
00037                                  int fd, uint32 share_mode)
00038 {
00039 
00040         START_PROFILE(syscall_kernel_flock);
00041 
00042         kernel_flock(fsp->fh->fd, share_mode);
00043 
00044         if (!set_gpfs_sharemode(fsp, fsp->access_mask, fsp->share_access)) {
00045 
00046                 return -1;
00047 
00048         }
00049 
00050         END_PROFILE(syscall_kernel_flock);
00051 
00052         return 0;
00053 }
00054 
00055 static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, 
00056                                  int fd, int leasetype)
00057 {
00058         int ret;
00059         
00060         START_PROFILE(syscall_linux_setlease);
00061         
00062         if ( linux_set_lease_sighandler(fd) == -1)
00063                 return -1;
00064 
00065         ret = set_gpfs_lease(fd,leasetype);
00066         
00067         if ( ret < 0 ) {
00068                 /* This must have come from GPFS not being available */
00069                 /* or some other error, hence call the default */
00070                 ret = linux_setlease(fd, leasetype);
00071         }
00072 
00073         END_PROFILE(syscall_linux_setlease);
00074 
00075         return ret;
00076 }
00077 
00078 
00079 
00080 static void gpfs_dumpacl(int level, struct gpfs_acl *gacl)
00081 {
00082         int     i;
00083         if (gacl==NULL)
00084         {
00085                 DEBUG(0, ("gpfs acl is NULL\n"));
00086                 return;
00087         }
00088 
00089         DEBUG(level, ("gpfs acl: nace: %d, type:%d, version:%d, level:%d, len:%d\n",
00090                 gacl->acl_nace, gacl->acl_type, gacl->acl_version, gacl->acl_level, gacl->acl_len));
00091         for(i=0; i<gacl->acl_nace; i++)
00092         {
00093                 struct gpfs_ace_v4 *gace = gacl->ace_v4 + i;
00094                 DEBUG(level, ("\tace[%d]: type:%d, flags:0x%x, mask:0x%x, iflags:0x%x, who:%u\n",
00095                         i, gace->aceType, gace->aceFlags, gace->aceMask,
00096                         gace->aceIFlags, gace->aceWho));
00097         }
00098 }
00099 
00100 static struct gpfs_acl *gpfs_getacl_alloc(const char *fname, gpfs_aclType_t type)
00101 {
00102         struct gpfs_acl *acl;
00103         size_t len = 200;
00104         int ret;
00105         TALLOC_CTX *mem_ctx = main_loop_talloc_get();
00106 
00107         acl = (struct gpfs_acl *)TALLOC_SIZE(mem_ctx, len);
00108         if (acl == NULL) {
00109                 errno = ENOMEM;
00110                 return NULL;
00111         }
00112 
00113         acl->acl_len = len;
00114         acl->acl_level = 0;
00115         acl->acl_version = 0;
00116         acl->acl_type = type;
00117 
00118         ret = smbd_gpfs_getacl((char *)fname, GPFS_GETACL_STRUCT | GPFS_ACL_SAMBA, acl);
00119         if ((ret != 0) && (errno == ENOSPC)) {
00120                 struct gpfs_acl *new_acl = (struct gpfs_acl *)TALLOC_SIZE(
00121                         mem_ctx, acl->acl_len + sizeof(struct gpfs_acl));
00122                 if (new_acl == NULL) {
00123                         errno = ENOMEM;
00124                         return NULL;
00125                 }
00126 
00127                 new_acl->acl_len = acl->acl_len;
00128                 new_acl->acl_level = acl->acl_level;
00129                 new_acl->acl_version = acl->acl_version;
00130                 new_acl->acl_type = acl->acl_type;
00131                 acl = new_acl;
00132 
00133                 ret = smbd_gpfs_getacl((char *)fname, GPFS_GETACL_STRUCT | GPFS_ACL_SAMBA, acl);
00134         }
00135         if (ret != 0)
00136         {
00137                 DEBUG(8, ("smbd_gpfs_getacl failed with %s\n",strerror(errno)));
00138                 return NULL;
00139         }
00140 
00141         return acl;
00142 }
00143 
00144 static BOOL gpfs_get_nfs4_acl(struct files_struct *fsp, SMB4ACL_T **ppacl, BOOL *pretryPosix)
00145 {
00146         TALLOC_CTX *mem_ctx;
00147         int i;
00148         struct gpfs_acl *gacl = NULL;
00149 
00150         mem_ctx = main_loop_talloc_get();
00151 
00152         DEBUG(10, ("gpfs_get_nfs4_acl invoked for %s\n", fsp->fsp_name));
00153 
00154         /* First get the real acl length */
00155         gacl = gpfs_getacl_alloc(fsp->fsp_name, GPFS_ACL_TYPE_NFS4);
00156         if (gacl == NULL) {
00157                 DEBUG(9, ("gpfs_getacl failed for %s with %s\n",
00158                            fsp->fsp_name, strerror(errno)));
00159                 return False;
00160         }
00161 
00162         if (gacl->acl_type != GPFS_ACL_TYPE_NFS4) {
00163                 DEBUG(10, ("Got non-nfsv4 acl\n"));
00164                 *pretryPosix = True;
00165                 return False;
00166         }
00167 
00168         *ppacl = smb_create_smb4acl();
00169 
00170         DEBUG(10, ("len: %d, level: %d, version: %d, nace: %d\n",
00171                    gacl->acl_len, gacl->acl_level, gacl->acl_version,
00172                    gacl->acl_nace));
00173 
00174         for (i=0; i<gacl->acl_nace; i++) {
00175                 struct gpfs_ace_v4 *gace = &gacl->ace_v4[i];
00176                 SMB_ACE4PROP_T smbace;
00177                 memset(&smbace, 0, sizeof(SMB4ACE_T));
00178 
00179                 DEBUG(10, ("type: %d, iflags: %x, flags: %x, mask: %x, "
00180                            "who: %d\n", gace->aceType, gace->aceIFlags,
00181                            gace->aceFlags, gace->aceMask, gace->aceWho));
00182 
00183                 if (gace->aceIFlags & ACE4_IFLAG_SPECIAL_ID) {
00184                         smbace.flags |= SMB_ACE4_ID_SPECIAL;
00185                         switch (gace->aceWho) {
00186                         case ACE4_SPECIAL_OWNER:
00187                                 smbace.who.special_id = SMB_ACE4_WHO_OWNER;
00188                                 break;
00189                         case ACE4_SPECIAL_GROUP:
00190                                 smbace.who.special_id = SMB_ACE4_WHO_GROUP;
00191                                 break;
00192                         case ACE4_SPECIAL_EVERYONE:
00193                                 smbace.who.special_id = SMB_ACE4_WHO_EVERYONE;
00194                                 break;
00195                         default:
00196                                 DEBUG(8, ("invalid special gpfs id %d "
00197                                           "ignored\n", gace->aceWho));
00198                                 continue; /* don't add it */
00199                         }
00200                 } else {
00201                         if (gace->aceFlags & ACE4_FLAG_GROUP_ID)
00202                                 smbace.who.gid = gace->aceWho;
00203                         else
00204                                 smbace.who.uid = gace->aceWho;
00205                 }
00206 
00207                 smbace.aceType = gace->aceType;
00208                 smbace.aceFlags = gace->aceFlags;
00209                 smbace.aceMask = gace->aceMask;
00210                 smbace.flags = (gace->aceIFlags&ACE4_IFLAG_SPECIAL_ID) ? SMB_ACE4_ID_SPECIAL : 0;
00211 
00212                 smb_add_ace4(*ppacl, &smbace);
00213         }
00214 
00215         return True;
00216 }
00217 
00218 static size_t gpfsacl_get_nt_acl_common(files_struct *fsp,
00219         uint32 security_info, SEC_DESC **ppdesc)
00220 {
00221         SMB4ACL_T *pacl = NULL;
00222         BOOL    result;
00223         BOOL    retryPosix = False;
00224 
00225         *ppdesc = NULL;
00226         result = gpfs_get_nfs4_acl(fsp, &pacl, &retryPosix);
00227         if (retryPosix)
00228         {
00229                 DEBUG(10, ("retrying with posix acl...\n"));
00230                 return get_nt_acl(fsp, security_info, ppdesc);
00231         }
00232         if (result==False)
00233                 return 0;
00234 
00235         return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
00236 }
00237 
00238 size_t gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
00239         files_struct *fsp, int fd, uint32 security_info,
00240         SEC_DESC **ppdesc)
00241 {
00242         return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc);
00243 }
00244 
00245 size_t gpfsacl_get_nt_acl(vfs_handle_struct *handle,
00246         files_struct *fsp, const char *name,
00247         uint32 security_info, SEC_DESC **ppdesc)
00248 {
00249         return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc);
00250 }
00251 
00252 static BOOL gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
00253 {
00254         int ret;
00255         gpfs_aclLen_t gacl_len;
00256         SMB4ACE_T       *smbace;
00257         struct gpfs_acl *gacl;
00258         TALLOC_CTX *mem_ctx  = main_loop_talloc_get();
00259 
00260         gacl_len = sizeof(struct gpfs_acl) +
00261                 (smb_get_naces(smbacl)-1)*sizeof(gpfs_ace_v4_t);
00262 
00263         gacl = TALLOC_SIZE(mem_ctx, gacl_len);
00264         if (gacl == NULL) {
00265                 DEBUG(0, ("talloc failed\n"));
00266                 errno = ENOMEM;
00267                 return False;
00268         }
00269 
00270         gacl->acl_len = gacl_len;
00271         gacl->acl_level = 0;
00272         gacl->acl_version = GPFS_ACL_VERSION_NFS4;
00273         gacl->acl_type = GPFS_ACL_TYPE_NFS4;
00274         gacl->acl_nace = 0; /* change later... */
00275 
00276         for (smbace=smb_first_ace4(smbacl); smbace!=NULL; smbace = smb_next_ace4(smbace)) {
00277                 struct gpfs_ace_v4 *gace = &gacl->ace_v4[gacl->acl_nace];
00278                 SMB_ACE4PROP_T  *aceprop = smb_get_ace4(smbace);
00279 
00280                 gace->aceType = aceprop->aceType;
00281                 gace->aceFlags = aceprop->aceFlags;
00282                 gace->aceMask = aceprop->aceMask;
00283                 gace->aceIFlags = (aceprop->flags&SMB_ACE4_ID_SPECIAL) ? ACE4_IFLAG_SPECIAL_ID : 0;
00284 
00285                 if (aceprop->flags&SMB_ACE4_ID_SPECIAL)
00286                 {
00287                         switch(aceprop->who.special_id)
00288                         {
00289                         case SMB_ACE4_WHO_EVERYONE:
00290                                 gace->aceWho = ACE4_SPECIAL_EVERYONE;
00291                                 break;
00292                         case SMB_ACE4_WHO_OWNER:
00293                                 gace->aceWho = ACE4_SPECIAL_OWNER;
00294                                 break;
00295                         case SMB_ACE4_WHO_GROUP:
00296                                 gace->aceWho = ACE4_SPECIAL_GROUP;
00297                                 break;
00298                         default:
00299                                 DEBUG(8, ("unsupported special_id %d\n", aceprop->who.special_id));
00300                                 continue; /* don't add it !!! */
00301                         }
00302                 } else {
00303                         /* just only for the type safety... */
00304                         if (aceprop->aceFlags&SMB_ACE4_IDENTIFIER_GROUP)
00305                                 gace->aceWho = aceprop->who.gid;
00306                         else
00307                                 gace->aceWho = aceprop->who.uid;
00308                 }
00309 
00310                 gacl->acl_nace++;
00311         }
00312 
00313         ret = smbd_gpfs_putacl(fsp->fsp_name, GPFS_PUTACL_STRUCT | GPFS_ACL_SAMBA, gacl);
00314         if (ret != 0) {
00315                 DEBUG(8, ("gpfs_putacl failed with %s\n", strerror(errno)));
00316                 gpfs_dumpacl(8, gacl);
00317                 return False;
00318         }
00319 
00320         DEBUG(10, ("gpfs_putacl succeeded\n"));
00321         return True;
00322 }
00323 
00324 static BOOL gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
00325 {
00326         struct gpfs_acl *acl;
00327         BOOL    result = False;
00328 
00329         acl = gpfs_getacl_alloc(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
00330         if (acl == NULL)
00331                 return False;
00332 
00333         if (acl->acl_version&GPFS_ACL_VERSION_NFS4)
00334         {
00335                 result = smb_set_nt_acl_nfs4(
00336                         fsp, security_info_sent, psd,
00337                         gpfsacl_process_smbacl);
00338         } else { /* assume POSIX ACL - by default... */
00339                 result = set_nt_acl(fsp, security_info_sent, psd);
00340         }
00341 
00342         return result;
00343 }
00344 
00345 static BOOL gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
00346 {
00347         return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
00348 }
00349 
00350 static BOOL gpfsacl_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, char *name, uint32 security_info_sent, SEC_DESC *psd)
00351 {
00352         return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
00353 }
00354 
00355 static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl)
00356 {
00357         SMB_ACL_T result;
00358         int i;
00359 
00360         result = sys_acl_init(pacl->acl_nace);
00361         if (result == NULL) {
00362                 errno = ENOMEM;
00363                 return NULL;
00364         }
00365 
00366         result->count = pacl->acl_nace;
00367 
00368         for (i=0; i<pacl->acl_nace; i++) {
00369                 struct smb_acl_entry *ace = &result->acl[i];
00370                 const struct gpfs_ace_v1 *g_ace = &pacl->ace_v1[i];
00371 
00372                 DEBUG(10, ("Converting type %d id %lu perm %x\n",
00373                            (int)g_ace->ace_type, (unsigned long)g_ace->ace_who,
00374                            (int)g_ace->ace_perm));
00375 
00376                 switch (g_ace->ace_type) {
00377                 case GPFS_ACL_USER:
00378                         ace->a_type = SMB_ACL_USER;
00379                         ace->uid = (uid_t)g_ace->ace_who;
00380                         break;
00381                 case GPFS_ACL_USER_OBJ:
00382                         ace->a_type = SMB_ACL_USER_OBJ;
00383                         break;
00384                 case GPFS_ACL_GROUP:
00385                         ace->a_type = SMB_ACL_GROUP;
00386                         ace->gid = (gid_t)g_ace->ace_who;
00387                         break;
00388                 case GPFS_ACL_GROUP_OBJ:
00389                         ace->a_type = SMB_ACL_GROUP_OBJ;
00390                         break;
00391                 case GPFS_ACL_OTHER:
00392                         ace->a_type = SMB_ACL_OTHER;
00393                         break;
00394                 case GPFS_ACL_MASK:
00395                         ace->a_type = SMB_ACL_MASK;
00396                         break;
00397                 default:
00398                         DEBUG(10, ("Got invalid ace_type: %d\n",
00399                                    g_ace->ace_type));
00400                         errno = EINVAL;
00401                         SAFE_FREE(result);
00402                         return NULL;
00403                 }
00404 
00405                 ace->a_perm = 0;
00406                 ace->a_perm |= (g_ace->ace_perm & ACL_PERM_READ) ?
00407                         SMB_ACL_READ : 0;
00408                 ace->a_perm |= (g_ace->ace_perm & ACL_PERM_WRITE) ?
00409                         SMB_ACL_WRITE : 0;
00410                 ace->a_perm |= (g_ace->ace_perm & ACL_PERM_EXECUTE) ?
00411                         SMB_ACL_EXECUTE : 0;
00412 
00413                 DEBUGADD(10, ("Converted to %d perm %x\n",
00414                               ace->a_type, ace->a_perm));
00415         }
00416 
00417         return result;
00418 }
00419 
00420 static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type)
00421 {
00422         struct gpfs_acl *pacl;
00423         SMB_ACL_T result = NULL;
00424 
00425         pacl = gpfs_getacl_alloc(path, type);
00426 
00427         if (pacl == NULL) {
00428                 DEBUG(10, ("gpfs_getacl failed for %s with %s\n",
00429                            path, strerror(errno)));
00430                 if (errno == 0) {
00431                         errno = EINVAL;
00432                 }
00433                 goto done;
00434         }
00435 
00436         if (pacl->acl_version != GPFS_ACL_VERSION_POSIX) {
00437                 DEBUG(10, ("Got acl version %d, expected %d\n",
00438                            pacl->acl_version, GPFS_ACL_VERSION_POSIX));
00439                 errno = EINVAL;
00440                 goto done;
00441         }
00442         
00443         DEBUG(10, ("len: %d, level: %d, version: %d, nace: %d\n",
00444                    pacl->acl_len, pacl->acl_level, pacl->acl_version,
00445                    pacl->acl_nace));
00446 
00447         result = gpfs2smb_acl(pacl);
00448         if (result == NULL) {
00449                 goto done;
00450         }
00451 
00452  done:
00453 
00454         if (errno != 0) {
00455                 SAFE_FREE(result);
00456         }
00457         return result;  
00458 }
00459 
00460 SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
00461                                     
00462                                     const char *path_p,
00463                                     SMB_ACL_TYPE_T type)
00464 {
00465         gpfs_aclType_t gpfs_type;
00466 
00467         switch(type) {
00468         case SMB_ACL_TYPE_ACCESS:
00469                 gpfs_type = GPFS_ACL_TYPE_ACCESS;
00470                 break;
00471         case SMB_ACL_TYPE_DEFAULT:
00472                 gpfs_type = GPFS_ACL_TYPE_DEFAULT;
00473                 break;
00474         default:
00475                 DEBUG(0, ("Got invalid type: %d\n", type));
00476                 smb_panic("exiting");
00477         }
00478 
00479         return gpfsacl_get_posix_acl(path_p, gpfs_type);
00480 }
00481 
00482 SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
00483                                   files_struct *fsp,
00484                                   int fd)
00485 {
00486         return gpfsacl_get_posix_acl(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
00487 }
00488 
00489 static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl,
00490                                      SMB_ACL_TYPE_T type)
00491 {
00492         gpfs_aclLen_t len;
00493         struct gpfs_acl *result;
00494         int i;
00495         union gpfs_ace_union
00496         {
00497                 gpfs_ace_v1_t  ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */
00498                 gpfs_ace_v4_t  ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4  */
00499         };
00500 
00501         DEBUG(10, ("smb2gpfs_acl: Got ACL with %d entries\n", pacl->count));
00502 
00503         len = sizeof(struct gpfs_acl) - sizeof(union gpfs_ace_union) +
00504                 (pacl->count)*sizeof(gpfs_ace_v1_t);
00505 
00506         result = SMB_MALLOC(len);
00507         if (result == NULL) {
00508                 errno = ENOMEM;
00509                 return result;
00510         }
00511 
00512         result->acl_len = len;
00513         result->acl_level = 0;
00514         result->acl_version = GPFS_ACL_VERSION_POSIX;
00515         result->acl_type = (type == SMB_ACL_TYPE_DEFAULT) ?
00516                 GPFS_ACL_TYPE_DEFAULT : GPFS_ACL_TYPE_ACCESS;
00517         result->acl_nace = pacl->count;
00518 
00519         for (i=0; i<pacl->count; i++) {
00520                 const struct smb_acl_entry *ace = &pacl->acl[i];
00521                 struct gpfs_ace_v1 *g_ace = &result->ace_v1[i];
00522                 
00523                 DEBUG(10, ("Converting type %d perm %x\n",
00524                            (int)ace->a_type, (int)ace->a_perm));
00525 
00526                 g_ace->ace_perm = 0;
00527 
00528                 switch(ace->a_type) {
00529                 case SMB_ACL_USER:
00530                         g_ace->ace_type = GPFS_ACL_USER;
00531                         g_ace->ace_who = (gpfs_uid_t)ace->uid;
00532                         break;
00533                 case SMB_ACL_USER_OBJ:
00534                         g_ace->ace_type = GPFS_ACL_USER_OBJ;
00535                         g_ace->ace_perm |= ACL_PERM_CONTROL;
00536                         g_ace->ace_who = 0;
00537                         break;
00538                 case SMB_ACL_GROUP:
00539                         g_ace->ace_type = GPFS_ACL_GROUP;
00540                         g_ace->ace_who = (gpfs_uid_t)ace->gid;
00541                         break;
00542                 case SMB_ACL_GROUP_OBJ:
00543                         g_ace->ace_type = GPFS_ACL_GROUP_OBJ;
00544                         g_ace->ace_who = 0;
00545                         break;
00546                 case SMB_ACL_MASK:
00547                         g_ace->ace_type = GPFS_ACL_MASK;
00548                         g_ace->ace_perm = 0x8f;
00549                         g_ace->ace_who = 0;
00550                         break;
00551                 case SMB_ACL_OTHER:
00552                         g_ace->ace_type = GPFS_ACL_OTHER;
00553                         g_ace->ace_who = 0;
00554                         break;
00555                 default:
00556                         DEBUG(10, ("Got invalid ace_type: %d\n", ace->a_type));
00557                         errno = EINVAL;
00558                         SAFE_FREE(result);
00559                         return NULL;
00560                 }
00561 
00562                 g_ace->ace_perm |= (ace->a_perm & SMB_ACL_READ) ?
00563                         ACL_PERM_READ : 0;
00564                 g_ace->ace_perm |= (ace->a_perm & SMB_ACL_WRITE) ?
00565                         ACL_PERM_WRITE : 0;
00566                 g_ace->ace_perm |= (ace->a_perm & SMB_ACL_EXECUTE) ?
00567                         ACL_PERM_EXECUTE : 0;
00568 
00569                 DEBUGADD(10, ("Converted to %d id %d perm %x\n",
00570                               g_ace->ace_type, g_ace->ace_who, g_ace->ace_perm));
00571         }
00572 
00573         return result;
00574 }
00575 
00576 int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
00577                               
00578                               const char *name,
00579                               SMB_ACL_TYPE_T type,
00580                               SMB_ACL_T theacl)
00581 {
00582         struct gpfs_acl *gpfs_acl;
00583         int result;
00584 
00585         gpfs_acl = smb2gpfs_acl(theacl, type);
00586         if (gpfs_acl == NULL) {
00587                 return -1;
00588         }
00589 
00590         result = smbd_gpfs_putacl((char *)name, GPFS_PUTACL_STRUCT | GPFS_ACL_SAMBA, gpfs_acl);
00591 
00592         SAFE_FREE(gpfs_acl);
00593         return result;
00594 }
00595 
00596 int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
00597                             files_struct *fsp,
00598                             int fd, SMB_ACL_T theacl)
00599 {
00600         return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name, SMB_ACL_TYPE_ACCESS, theacl);
00601 }
00602 
00603 int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
00604                                      
00605                                      const char *path)
00606 {
00607         errno = ENOTSUP;
00608         return -1;
00609 }
00610 
00611 /* VFS operations structure */
00612 
00613 static vfs_op_tuple gpfs_op_tuples[] = {
00614 
00615         {SMB_VFS_OP(vfs_gpfs_kernel_flock),
00616          SMB_VFS_OP_KERNEL_FLOCK,
00617          SMB_VFS_LAYER_OPAQUE},
00618 
00619         {SMB_VFS_OP(vfs_gpfs_setlease),
00620          SMB_VFS_OP_LINUX_SETLEASE,
00621          SMB_VFS_LAYER_OPAQUE},
00622 
00623         {SMB_VFS_OP(gpfsacl_fget_nt_acl),
00624         SMB_VFS_OP_FGET_NT_ACL,
00625         SMB_VFS_LAYER_TRANSPARENT},
00626 
00627         {SMB_VFS_OP(gpfsacl_get_nt_acl),
00628         SMB_VFS_OP_GET_NT_ACL,
00629         SMB_VFS_LAYER_TRANSPARENT},
00630 
00631         {SMB_VFS_OP(gpfsacl_fset_nt_acl),
00632         SMB_VFS_OP_FSET_NT_ACL,
00633         SMB_VFS_LAYER_TRANSPARENT},
00634 
00635         {SMB_VFS_OP(gpfsacl_set_nt_acl),
00636         SMB_VFS_OP_SET_NT_ACL,
00637         SMB_VFS_LAYER_TRANSPARENT},
00638 
00639         {SMB_VFS_OP(gpfsacl_sys_acl_get_file),
00640          SMB_VFS_OP_SYS_ACL_GET_FILE,
00641          SMB_VFS_LAYER_TRANSPARENT},
00642 
00643         {SMB_VFS_OP(gpfsacl_sys_acl_get_fd),
00644          SMB_VFS_OP_SYS_ACL_GET_FD,
00645          SMB_VFS_LAYER_TRANSPARENT},
00646 
00647         {SMB_VFS_OP(gpfsacl_sys_acl_set_file),
00648          SMB_VFS_OP_SYS_ACL_SET_FILE,
00649          SMB_VFS_LAYER_TRANSPARENT},
00650 
00651         {SMB_VFS_OP(gpfsacl_sys_acl_set_fd),
00652          SMB_VFS_OP_SYS_ACL_SET_FD,
00653          SMB_VFS_LAYER_TRANSPARENT},
00654 
00655         {SMB_VFS_OP(gpfsacl_sys_acl_delete_def_file),
00656          SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
00657          SMB_VFS_LAYER_TRANSPARENT},
00658 
00659         {SMB_VFS_OP(NULL),
00660          SMB_VFS_OP_NOOP,
00661          SMB_VFS_LAYER_NOOP}
00662 
00663 };
00664 
00665 
00666 NTSTATUS vfs_gpfs_init(void);
00667 NTSTATUS vfs_gpfs_init(void)
00668 {
00669         init_gpfs();
00670         
00671         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "gpfs",
00672                                 gpfs_op_tuples);
00673 }

Sambaに対してSat Aug 29 21:23:07 2009に生成されました。  doxygen 1.4.7