static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, struct tevent_context *ev, const char * which, const char **ports, struct smbcli_options *smb_options, const char *socket_options, struct smbcli_session_options *smb_session_options, struct gensec_settings *gensec_settings) { int options = 0; const char * path = NULL; struct dd_iohandle * handle = NULL; if (check_arg_bool("direct")) { options |= DD_DIRECT_IO; } if (check_arg_bool("sync")) { options |= DD_SYNC_IO; } if (check_arg_bool("oplock")) { options |= DD_OPLOCK; } if (strcmp(which, "if") == 0) { path = check_arg_pathname("if"); handle = dd_open_path(resolve_ctx, ev, path, ports, check_arg_numeric("ibs"), options, socket_options, smb_options, smb_session_options, gensec_settings); } else if (strcmp(which, "of") == 0) { options |= DD_WRITE; path = check_arg_pathname("of"); handle = dd_open_path(resolve_ctx, ev, path, ports, check_arg_numeric("obs"), options, socket_options, smb_options, smb_session_options, gensec_settings); } else { SMB_ASSERT(0); return(NULL); } if (!handle) { fprintf(stderr, "%s: failed to open %s\n", PROGNAME, path); } return(handle); }
static struct dd_iohandle * open_file(const char * which) { int options = 0; const char * path = NULL; struct dd_iohandle * handle = NULL; if (check_arg_bool("direct")) { options |= DD_DIRECT_IO; } if (check_arg_bool("sync")) { options |= DD_SYNC_IO; } if (check_arg_bool("oplock")) { options |= DD_OPLOCK; } if (strcmp(which, "if") == 0) { path = check_arg_pathname("if"); handle = dd_open_path(path, check_arg_numeric("ibs"), options); } else if (strcmp(which, "of") == 0) { options |= DD_WRITE; path = check_arg_pathname("of"); handle = dd_open_path(path, check_arg_numeric("obs"), options); } else { SMB_ASSERT(0); return(NULL); } if (!handle) { fprintf(stderr, "%s: failed to open %s\n", PROGNAME, path); } return(handle); }