From 2320b2144fcb1236c082278444e3c6df998e17ec Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 28 Mar 2012 13:18:14 +1100 Subject: build: Remove SMB_STRUCT_DIRENT define --- source3/include/includes.h | 8 -------- source3/include/vfs.h | 4 ++-- source3/lib/util.c | 4 ++-- source3/modules/onefs.h | 2 +- source3/modules/onefs_dir.c | 8 ++++---- source3/modules/onefs_streams.c | 2 +- source3/modules/vfs_cap.c | 12 ++++++------ source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_dirsort.c | 12 ++++++------ source3/modules/vfs_full_audit.c | 4 ++-- source3/modules/vfs_netatalk.c | 2 +- source3/modules/vfs_scannedonly.c | 16 ++++++++-------- source3/modules/vfs_shadow_copy.c | 14 +++++++------- source3/modules/vfs_shadow_copy2.c | 2 +- source3/modules/vfs_time_audit.c | 4 ++-- source3/param/loadparm.c | 2 +- source3/smbd/vfs.c | 4 ++-- source3/torture/cmd_vfs.c | 2 +- source3/utils/net_usershare.c | 4 ++-- 19 files changed, 51 insertions(+), 59 deletions(-) (limited to 'source3') diff --git a/source3/include/includes.h b/source3/include/includes.h index ee7bb1cb7c..ffdc1d28f3 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -367,14 +367,6 @@ struct stat_ex { typedef struct stat_ex SMB_STRUCT_STAT; -/* - * Type for dirent structure. - */ - -#ifndef SMB_STRUCT_DIRENT -# define SMB_STRUCT_DIRENT struct dirent -#endif - /* * Type for DIR structure. */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 212da7e514..023f5b177e 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -206,7 +206,7 @@ struct vfs_fn_pointers { SMB_STRUCT_DIR *(*opendir_fn)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes); SMB_STRUCT_DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attributes); - SMB_STRUCT_DIRENT *(*readdir_fn)(struct vfs_handle_struct *handle, + struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf); void (*seekdir_fn)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset); @@ -560,7 +560,7 @@ SMB_STRUCT_DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *mask, uint32 attributes); -SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle, +struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf); void smb_vfs_call_seekdir(struct vfs_handle_struct *handle, diff --git a/source3/lib/util.c b/source3/lib/util.c index 88001cedc8..b727f7b3d8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1031,13 +1031,13 @@ libunwind_failed: const char *readdirname(SMB_STRUCT_DIR *p) { - SMB_STRUCT_DIRENT *ptr; + struct dirent *ptr; char *dname; if (!p) return(NULL); - ptr = (SMB_STRUCT_DIRENT *)readdir(p); + ptr = (struct dirent *)readdir(p); if (!ptr) return(NULL); diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h index e7ac0eb72d..926138bdab 100644 --- a/source3/modules/onefs.h +++ b/source3/modules/onefs.h @@ -28,7 +28,7 @@ SMB_STRUCT_DIR *onefs_opendir(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes); -SMB_STRUCT_DIRENT *onefs_readdir(struct vfs_handle_struct *handle, +struct dirent *onefs_readdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf); void onefs_seekdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, diff --git a/source3/modules/onefs_dir.c b/source3/modules/onefs_dir.c index eb11b9725c..00ea145b2c 100644 --- a/source3/modules/onefs_dir.c +++ b/source3/modules/onefs_dir.c @@ -296,12 +296,12 @@ onefs_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, * * @return dirent structure, NULL if at the end of the directory, NULL on error */ -SMB_STRUCT_DIRENT * +struct dirent * onefs_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { struct rdp_dir_state *dsp = NULL; - SMB_STRUCT_DIRENT *ret_direntp; + struct dirent *ret_direntp; bool same_as_last, filled_cache = false; int ret = -1; @@ -355,7 +355,7 @@ onefs_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, * our cursor, then return the next entry */ if (!filled_cache) { dsp->direntries_cursor += - ((SMB_STRUCT_DIRENT *)dsp->direntries_cursor)->d_reclen; + ((struct dirent *)dsp->direntries_cursor)->d_reclen; dsp->stat_cursor++; } @@ -366,7 +366,7 @@ onefs_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, dsp->resume_cookie = rdp_cookies[dsp->stat_cursor]; /* Return an entry from cache */ - ret_direntp = ((SMB_STRUCT_DIRENT *)dsp->direntries_cursor); + ret_direntp = ((struct dirent *)dsp->direntries_cursor); if (sbuf) { struct stat onefs_sbuf; diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c index a9b4066cc7..221825cdab 100644 --- a/source3/modules/onefs_streams.c +++ b/source3/modules/onefs_streams.c @@ -584,7 +584,7 @@ static NTSTATUS walk_onefs_streams(connection_struct *conn, files_struct *fsp, int stream_fd = -1; int ret; SMB_STRUCT_DIR *dirp = NULL; - SMB_STRUCT_DIRENT *dp = NULL; + struct dirent *dp = NULL; files_struct fake_fs; struct fd_handle fake_fh; SMB_STRUCT_STAT stream_sbuf; diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 06ff89d89b..e7539902bc 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -54,12 +54,12 @@ static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, const char *fname, return SMB_VFS_NEXT_OPENDIR(handle, capname, mask, attr); } -static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, +static struct dirent *cap_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { - SMB_STRUCT_DIRENT *result; - SMB_STRUCT_DIRENT *newdirent; + struct dirent *result; + struct dirent *newdirent; char *newname; size_t newnamelen; DEBUG(3,("cap: cap_readdir\n")); @@ -75,14 +75,14 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, } DEBUG(3,("cap: cap_readdir: %s\n", newname)); newnamelen = strlen(newname)+1; - newdirent = (SMB_STRUCT_DIRENT *)talloc_array(talloc_tos(), + newdirent = (struct dirent *)talloc_array(talloc_tos(), char, - sizeof(SMB_STRUCT_DIRENT)+ + sizeof(struct dirent)+ newnamelen); if (!newdirent) { return NULL; } - memcpy(newdirent, result, sizeof(SMB_STRUCT_DIRENT)); + memcpy(newdirent, result, sizeof(struct dirent)); memcpy(&newdirent->d_name, newname, newnamelen); return newdirent; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 31f1192af7..1f3dd6a89b 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -367,11 +367,11 @@ static SMB_STRUCT_DIR *vfswrap_fdopendir(vfs_handle_struct *handle, } -static SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, +static struct dirent *vfswrap_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { - SMB_STRUCT_DIRENT *result; + struct dirent *result; START_PROFILE(syscall_readdir); result = readdir(dirp); diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c index 1c7aaba640..7067a5892b 100644 --- a/source3/modules/vfs_dirsort.c +++ b/source3/modules/vfs_dirsort.c @@ -22,14 +22,14 @@ #include "smbd/smbd.h" #include "system/filesys.h" -static int compare_dirent (const SMB_STRUCT_DIRENT *da, const SMB_STRUCT_DIRENT *db) +static int compare_dirent (const struct dirent *da, const struct dirent *db) { return strcasecmp_m(da->d_name, db->d_name); } struct dirsort_privates { long pos; - SMB_STRUCT_DIRENT *directory_list; + struct dirent *directory_list; long number_of_entries; time_t mtime; SMB_STRUCT_DIR *source_directory; @@ -47,7 +47,7 @@ static void free_dirsort_privates(void **datap) { static bool open_and_sort_dir (vfs_handle_struct *handle) { - SMB_STRUCT_DIRENT *dp; + struct dirent *dp; struct stat dir_stat; long current_pos; struct dirsort_privates *data = NULL; @@ -72,8 +72,8 @@ static bool open_and_sort_dir (vfs_handle_struct *handle) /* Set up an array and read the directory entries into it */ SAFE_FREE(data->directory_list); /* destroy previous cache if needed */ - data->directory_list = (SMB_STRUCT_DIRENT *)SMB_MALLOC( - data->number_of_entries * sizeof(SMB_STRUCT_DIRENT)); + data->directory_list = (struct dirent *)SMB_MALLOC( + data->number_of_entries * sizeof(struct dirent)); if (!data->directory_list) { return false; } @@ -166,7 +166,7 @@ static SMB_STRUCT_DIR *dirsort_fdopendir(vfs_handle_struct *handle, return data->source_directory; } -static SMB_STRUCT_DIRENT *dirsort_readdir(vfs_handle_struct *handle, +static struct dirent *dirsort_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 770d21f9ef..7997c2fab7 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -760,10 +760,10 @@ static SMB_STRUCT_DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle, return result; } -static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle, +static struct dirent *smb_full_audit_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { - SMB_STRUCT_DIRENT *result; + struct dirent *result; result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf); diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c index 4e5df48ac8..c4a65e07ff 100644 --- a/source3/modules/vfs_netatalk.c +++ b/source3/modules/vfs_netatalk.c @@ -152,7 +152,7 @@ static void atalk_add_to_list(name_compare_entry **list) static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) { char *dpath; - SMB_STRUCT_DIRENT *dent = 0; + struct dirent *dent = 0; SMB_STRUCT_DIR *dir; if (!path) return; diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c index fcd2ed0a1c..080e88c47e 100644 --- a/source3/modules/vfs_scannedonly.c +++ b/source3/modules/vfs_scannedonly.c @@ -446,7 +446,7 @@ static bool scannedonly_allow_access(vfs_handle_struct * handle, /* check the rest of the directory and notify the scanner if some file needs scanning */ long offset; - SMB_STRUCT_DIRENT *dire; + struct dirent *dire; offset = SMB_VFS_NEXT_TELLDIR(handle, sDIR->DIR); dire = SMB_VFS_NEXT_READDIR(handle, sDIR->DIR, NULL); @@ -560,17 +560,17 @@ static SMB_STRUCT_DIR *scannedonly_fdopendir(vfs_handle_struct * handle, } -static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle, +static struct dirent *scannedonly_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR * dirp, SMB_STRUCT_STAT *sbuf) { - SMB_STRUCT_DIRENT *result; + struct dirent *result; int allowed = 0; char *tmp; struct smb_filename *smb_fname; char *notify_name; int namelen; - SMB_STRUCT_DIRENT *newdirent; + struct dirent *newdirent; TALLOC_CTX *ctx=talloc_tos(); struct scannedonly_DIR *sDIR = (struct scannedonly_DIR *)dirp; @@ -634,12 +634,12 @@ static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle, ctx,"%s %s",result->d_name, STRUCTSCANO(handle->data)->scanning_message); namelen = strlen(notify_name); - newdirent = (SMB_STRUCT_DIRENT *)talloc_array( - ctx, char, sizeof(SMB_STRUCT_DIRENT) + namelen + 1); + newdirent = (struct dirent *)talloc_array( + ctx, char, sizeof(struct dirent) + namelen + 1); if (!newdirent) { return NULL; } - memcpy(newdirent, result, sizeof(SMB_STRUCT_DIRENT)); + memcpy(newdirent, result, sizeof(struct dirent)); memcpy(&newdirent->d_name, notify_name, namelen + 1); DEBUG(SCANNEDONLY_DEBUG, ("scannedonly_readdir, return newdirent at %p with " @@ -860,7 +860,7 @@ static int scannedonly_rmdir(vfs_handle_struct * handle, const char *path) /* if there are only .scanned: .virus: or .failed: files, we delete those, because the client cannot see them */ DIR *dirp; - SMB_STRUCT_DIRENT *dire; + struct dirent *dire; TALLOC_CTX *ctx = talloc_tos(); bool only_deletable_files = true, have_files = false; char *path_w_slash; diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c index f3f4292cf0..3f9bc96f0c 100644 --- a/source3/modules/vfs_shadow_copy.c +++ b/source3/modules/vfs_shadow_copy.c @@ -60,7 +60,7 @@ static int vfs_shadow_copy_debug_level = DBGC_VFS; typedef struct { int pos; int num; - SMB_STRUCT_DIRENT *dirs; + struct dirent *dirs; } shadow_copy_Dir; static bool shadow_copy_match_name(const char *name) @@ -93,7 +93,7 @@ static SMB_STRUCT_DIR *shadow_copy_opendir(vfs_handle_struct *handle, const char ZERO_STRUCTP(dirp); while (True) { - SMB_STRUCT_DIRENT *d; + struct dirent *d; d = SMB_VFS_NEXT_READDIR(handle, p, NULL); if (d == NULL) { @@ -107,7 +107,7 @@ static SMB_STRUCT_DIR *shadow_copy_opendir(vfs_handle_struct *handle, const char DEBUG(10,("shadow_copy_opendir: not hide [%s]\n",d->d_name)); - dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,SMB_STRUCT_DIRENT, dirp->num+1); + dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,struct dirent, dirp->num+1); if (!dirp->dirs) { DEBUG(0,("shadow_copy_opendir: Out of memory\n")); break; @@ -143,7 +143,7 @@ static SMB_STRUCT_DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_st ZERO_STRUCTP(dirp); while (True) { - SMB_STRUCT_DIRENT *d; + struct dirent *d; d = SMB_VFS_NEXT_READDIR(handle, p, NULL); if (d == NULL) { @@ -157,7 +157,7 @@ static SMB_STRUCT_DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_st DEBUG(10,("shadow_copy_fdopendir: not hide [%s]\n",d->d_name)); - dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,SMB_STRUCT_DIRENT, dirp->num+1); + dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,struct dirent, dirp->num+1); if (!dirp->dirs) { DEBUG(0,("shadow_copy_fdopendir: Out of memory\n")); break; @@ -172,7 +172,7 @@ static SMB_STRUCT_DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_st return((SMB_STRUCT_DIR *)dirp); } -static SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle, +static struct dirent *shadow_copy_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *_dirp, SMB_STRUCT_STAT *sbuf) { @@ -233,7 +233,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, while (True) { SHADOW_COPY_LABEL *tlabels; - SMB_STRUCT_DIRENT *d; + struct dirent *d; d = SMB_VFS_NEXT_READDIR(handle, p, NULL); if (d == NULL) { diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 02c5b3d580..14d33085c2 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1078,7 +1078,7 @@ static int shadow_copy2_get_shadow_copy_data( { SMB_STRUCT_DIR *p; const char *snapdir; - SMB_STRUCT_DIRENT *d; + struct dirent *d; TALLOC_CTX *tmp_ctx = talloc_stackframe(); snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle, fsp->fsp_name); diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 0066e075a2..76e917c15d 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -243,11 +243,11 @@ static SMB_STRUCT_DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle, return result; } -static SMB_STRUCT_DIRENT *smb_time_audit_readdir(vfs_handle_struct *handle, +static struct dirent *smb_time_audit_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { - SMB_STRUCT_DIRENT *result; + struct dirent *result; struct timespec ts1,ts2; double timediff; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 86ea4a433f..d42b04f18b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -8734,7 +8734,7 @@ int load_usershare_shares(struct smbd_server_connection *sconn, { SMB_STRUCT_DIR *dp; SMB_STRUCT_STAT sbuf; - SMB_STRUCT_DIRENT *de; + struct dirent *de; int num_usershares = 0; int max_user_shares = Globals.iUsershareMaxShares; unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index cbefb40659..cb7d2e4496 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -721,7 +721,7 @@ SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) const char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf, char **talloced) { - SMB_STRUCT_DIRENT *ptr= NULL; + struct dirent *ptr= NULL; const char *dname; char *translated; NTSTATUS status; @@ -1405,7 +1405,7 @@ SMB_STRUCT_DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle, return handle->fns->fdopendir_fn(handle, fsp, mask, attributes); } -SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle, +struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf) { diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 715dda9da3..b845048ebe 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -146,7 +146,7 @@ static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv) { SMB_STRUCT_STAT st; - SMB_STRUCT_DIRENT *dent = NULL; + struct dirent *dent = NULL; if (vfs->currentdir == NULL) { printf("readdir: error=-1 (no open directory)\n"); diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index e9490d1fb9..b7ec7a94c3 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -209,7 +209,7 @@ static struct file_list *flist; static int get_share_list(TALLOC_CTX *ctx, const char *wcard, bool only_ours) { SMB_STRUCT_DIR *dp; - SMB_STRUCT_DIRENT *de; + struct dirent *de; uid_t myuid = geteuid(); struct file_list *fl = NULL; char *basepath = get_basepath(ctx); @@ -547,7 +547,7 @@ static int net_usershare_info(struct net_context *c, int argc, const char **argv static int count_num_usershares(void) { SMB_STRUCT_DIR *dp; - SMB_STRUCT_DIRENT *de; + struct dirent *de; int num_usershares = 0; TALLOC_CTX *ctx = talloc_tos(); char *basepath = get_basepath(ctx); -- cgit