int hostfd = -1;
struct adouble *ad = NULL;
+ DBG_DEBUG("Path [%s]\n", smb_fname_str_dbg(smb_fname));
+
/* Create an smb_filename with stream_name == NULL. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
smb_fname->base_name,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
- int rc;
+ int fd;
struct fruit_config_data *config = NULL;
+ struct fio *fio = NULL;
DBG_DEBUG("path [%s]\n", smb_fname_str_dbg(smb_fname));
switch (config->meta) {
case FRUIT_META_STREAM:
- rc = fruit_open_meta_stream(handle, smb_fname,
+ fd = fruit_open_meta_stream(handle, smb_fname,
fsp, flags, mode);
break;
case FRUIT_META_NETATALK:
- rc = fruit_open_meta_netatalk(handle, smb_fname,
+ fd = fruit_open_meta_netatalk(handle, smb_fname,
fsp, flags, mode);
break;
return -1;
}
- DBG_DEBUG("path [%s] rc [%d]\n", smb_fname_str_dbg(smb_fname), rc);
- return rc;
+ DBG_DEBUG("path [%s] fd [%d]\n", smb_fname_str_dbg(smb_fname), fd);
+
+ if (fd == -1) {
+ return -1;
+ }
+
+ fio = (struct fio *)VFS_ADD_FSP_EXTENSION(handle, fsp, struct fio, NULL);
+ fio->type = ADOUBLE_META;
+ fio->config = config;
+
+ return fd;
}
static int fruit_open_rsrc_adouble(vfs_handle_struct *handle,
int rc = 0;
struct adouble *ad = NULL;
struct smb_filename *smb_fname_base = NULL;
+ struct fruit_config_data *config = NULL;
char *adpath = NULL;
int hostfd = -1;
+ SMB_VFS_HANDLE_GET_DATA(handle, config,
+ struct fruit_config_data, return -1);
+
if (!(flags & O_CREAT) && !VALID_STAT(smb_fname->st)) {
rc = SMB_VFS_NEXT_STAT(handle, smb_fname);
if (rc != 0) {
goto exit;
}
- /* REVIEW: we need this in ad_write() */
- fsp->fh->fd = hostfd;
-
if (flags & (O_CREAT | O_TRUNC)) {
ad = ad_init(fsp, handle, ADOUBLE_RSRC);
if (ad == NULL) {
{
#ifdef HAVE_ATTROPEN
int fd = -1;
- struct adouble *ad = NULL;
-
- ad = ad_init(VFS_MEMCTX_FSP_EXTENSION(handle, fsp),
- handle, ADOUBLE_RSRC, fsp);
- if (ad == NULL) {
- return -1;
- }
fd = attropen(smb_fname->base_name,
- AFPRESOURCE_EA_NETATALK, flags, mode);
+ AFPRESOURCE_EA_NETATALK,
+ flags,
+ mode);
if (fd == -1) {
return -1;
}
{
int fd;
struct fruit_config_data *config = NULL;
+ struct fio *fio = NULL;
DBG_DEBUG("Path [%s]\n", smb_fname_str_dbg(smb_fname));
}
DBG_DEBUG("Path [%s] fd [%d]\n", smb_fname_str_dbg(smb_fname), fd);
+
+ if (fd == -1) {
+ return -1;
+ }
+
+ fio = (struct fio *)VFS_ADD_FSP_EXTENSION(handle, fsp, struct fio, NULL);
+ fio->type = ADOUBLE_RSRC;
+ fio->config = config;
+
return fd;
}
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
- DEBUG(10, ("fruit_open called for %s\n",
- smb_fname_str_dbg(smb_fname)));
+ int fd;
+
+ DBG_DEBUG("Path [%s]\n", smb_fname_str_dbg(smb_fname));
if (!is_ntfs_stream_smb_fname(smb_fname)) {
return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
if (is_afpinfo_stream(smb_fname)) {
- return fruit_open_meta(handle, smb_fname, fsp, flags, mode);
+ fd = fruit_open_meta(handle, smb_fname, fsp, flags, mode);
} else if (is_afpresource_stream(smb_fname)) {
- return fruit_open_rsrc(handle, smb_fname, fsp, flags, mode);
+ fd = fruit_open_rsrc(handle, smb_fname, fsp, flags, mode);
+ } else {
+ fd = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
- return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
+ DBG_DEBUG("Path [%s] fd [%d]\n", smb_fname_str_dbg(smb_fname), fd);
+
+ return fd;
}
static int fruit_rename(struct vfs_handle_struct *handle,