Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/tftp.c
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
struct tftprecv_extra; | struct tftprecv_extra; | ||||
static ssize_t recvtftp(struct iodesc *d, void **pkt, void **payload, | static ssize_t recvtftp(struct iodesc *d, void **pkt, void **payload, | ||||
time_t tleft, void *recv_extra); | time_t tleft, void *recv_extra); | ||||
static int tftp_open(const char *path, struct open_file *f); | static int tftp_open(const char *path, struct open_file *f); | ||||
static int tftp_close(struct open_file *f); | static int tftp_close(struct open_file *f); | ||||
static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); | static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); | ||||
static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); | static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); | ||||
static int tftp_write(struct open_file *f, const void *buf, size_t size, | |||||
size_t *resid); | |||||
static off_t tftp_seek(struct open_file *f, off_t offset, int where); | static off_t tftp_seek(struct open_file *f, off_t offset, int where); | ||||
static int tftp_set_blksize(struct tftp_handle *h, const char *str); | static int tftp_set_blksize(struct tftp_handle *h, const char *str); | ||||
static int tftp_stat(struct open_file *f, struct stat *sb); | static int tftp_stat(struct open_file *f, struct stat *sb); | ||||
struct fs_ops tftp_fsops = { | struct fs_ops tftp_fsops = { | ||||
"tftp", | "tftp", | ||||
tftp_open, | tftp_open, | ||||
tftp_close, | tftp_close, | ||||
tftp_read, | tftp_read, | ||||
tftp_write, | null_write, | ||||
lidl: From a technical standpoint, there's nothing that prevents the tftp code from having write… | |||||
tsoomeAuthorUnsubmitted Not Done Inline ActionsYes, same for other filesystems too, except that it is rather confusing for user, unfortunately. Also specifically for tftp, it is quite common practice to keep tftpboot tree read only and tftpd service running with minimal rights... So it is not just about having the code not written, but we would rather keep it not written. tsoome: Yes, same for other filesystems too, except that it is rather confusing for user, unfortunately. | |||||
cemUnsubmitted Not Done Inline ActionsNot necessarily all other filesystems. iso9660 is probably exclusively RO. cem: Not necessarily all other filesystems. iso9660 is probably exclusively RO. | |||||
tftp_seek, | tftp_seek, | ||||
tftp_stat, | tftp_stat, | ||||
null_readdir | null_readdir | ||||
}; | }; | ||||
extern struct in_addr servip; | extern struct in_addr servip; | ||||
static int tftpport = 2000; | static int tftpport = 2000; | ||||
▲ Show 20 Lines • Show All 475 Lines • ▼ Show 20 Lines | tftp_close(struct open_file *f) | ||||
if (tftpfile) { | if (tftpfile) { | ||||
free(tftpfile->path); | free(tftpfile->path); | ||||
free(tftpfile->pkt); | free(tftpfile->pkt); | ||||
free(tftpfile); | free(tftpfile); | ||||
} | } | ||||
is_open = 0; | is_open = 0; | ||||
return (0); | return (0); | ||||
} | |||||
static int | |||||
tftp_write(struct open_file *f __unused, const void *start __unused, | |||||
size_t size __unused, size_t *resid __unused /* out */) | |||||
{ | |||||
return (EROFS); | |||||
} | } | ||||
static int | static int | ||||
tftp_stat(struct open_file *f, struct stat *sb) | tftp_stat(struct open_file *f, struct stat *sb) | ||||
{ | { | ||||
struct tftp_handle *tftpfile; | struct tftp_handle *tftpfile; | ||||
tftpfile = (struct tftp_handle *) f->f_fsdata; | tftpfile = (struct tftp_handle *) f->f_fsdata; | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |
From a technical standpoint, there's nothing that prevents the tftp code from having write method. I don't know that it would be terribly useful (except maybe for 'nextboot' type support).
Perhaps a comment is warranted here, to note that it could be done, it's just a SMOP (small matter of programming).