From: Christoph Hellwig <hch@infradead.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [iscsi 2/2] iscsi-probe.c
Date: Tue, 23 Sep 2003 16:53:01 +0100 [thread overview]
Message-ID: <20030923165301.A18885@infradead.org> (raw)
In-Reply-To: <20030923152306.GA14522@gtf.org>; from jgarzik@pobox.com on Tue, Sep 23, 2003 at 11:23:06AM -0400
> #include <linux/blk.h>
Okay, this is for review only, but only a 2.6 version would have the
slightest chance of getting merged some day..
> #include <endian.h>
Did you actually try to compile this? This is a userspace header and
not available in a kernel uild.
> /* these are from $(TOPDIR)/drivers/scsi, not $(TOPDIR)/include */
> #include <scsi.h>
> #include <hosts.h>
We tend to use "" includes for these. Also in 2.6 there's no need for
hosts.h anymore and soon scsi.h - use <scsi/*.h) instead.
> DECLARE_MUTEX(iscsi_lun_probe_mutex);
> spinlock_t iscsi_lun_probe_lock = SPIN_LOCK_UNLOCKED;
> static iscsi_session_t *iscsi_lun_probe_head = NULL;
> static iscsi_session_t *iscsi_lun_probe_tail = NULL;
> static iscsi_session_t *iscsi_currently_probing = NULL;
> static volatile int iscsi_next_probe = 0;
> volatile unsigned long iscsi_lun_probe_start = 0;
No need for initializers here, looks like someone didn't read the
basic docs.
>
> /* we need to make some syscalls to create and destroy the device name tree. */
> static int errno = 0;
Umm...
> static inline _syscall2(long, mkdir, const char *, dir, int, mode);
> static inline _syscall1(long, unlink, const char *, path);
> static inline _syscall2(long, symlink, const char *, oldname, const char *,
> newname);
> static inline
> _syscall3(int, open, const char *, file, int, flag, int, mode)
> static inline
> _syscall1(int, close, int, fd)
> static inline
> _syscall1(long, rmdir, const char *, path);
> static inline
> _syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count);
Even more umm...
> if (session->probe_next || session->probe_prev) {
> DEBUG_INIT
> ("iSCSI: session for bus_id id %d target_id %d already queued for LUN probing\n",
Please linewrap after 80 chars.
> if (iscsi_lun_probe_head) {
> if (session->probe_order < iscsi_lun_probe_head->probe_order) {
> /* insert before the current head */
> session->probe_prev = NULL;
> session->probe_next = iscsi_lun_probe_head;
> iscsi_lun_probe_head->probe_prev = session;
> iscsi_lun_probe_head = session;
Don't you want list.h lists here? (And all over the driver)
> /* try to write to /proc/scsi/scsi */
> static int
> write_proc_scsi_scsi(iscsi_session_t * session, char *str)
> {
> struct file *filp = NULL;
> loff_t offset = 0;
> int rc = 0;
> mm_segment_t oldfs = get_fs();
>
> set_fs(get_ds());
>
> filp = filp_open("/proc/scsi/scsi", O_WRONLY, 0);
> if (IS_ERR(filp)) {
> printk
> ("iSCSI: session (bus %d target %d)couldn't open /proc/scsi/scsi\n",
> session->iscsi_bus, session->target_id);
> set_fs(oldfs);
> return -ENOENT;
> }
>
> rc = filp->f_op->write(filp, str, strlen(str), &offset);
> filp_close(filp, 0);
> set_fs(oldfs);
Stop that crap. Now. I'm not going to review this any further until
all this asssumptions about random files in the namespace are fixed.
(the /dev messing below is even worse..)
next prev parent reply other threads:[~2003-09-23 15:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-23 15:23 [iscsi 2/2] iscsi-probe.c Jeff Garzik
2003-09-23 15:53 ` Christoph Hellwig [this message]
2003-09-24 3:43 ` Lincoln Dale
2003-09-24 12:37 ` Christoph Hellwig
2003-09-24 13:42 ` Sachin Mhatre (smhatre)
2003-09-24 13:48 ` 'Christoph Hellwig'
2003-09-24 14:14 ` Jeff Garzik
2003-09-24 16:20 ` Sachin Mhatre (smhatre)
2003-09-24 16:27 ` Jeff Garzik
2003-09-24 16:40 ` 'Christoph Hellwig'
2003-09-24 17:11 ` Patrick Mansfield
2003-09-24 17:30 ` 'Christoph Hellwig'
2003-09-24 18:26 ` Scott M. Ferris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030923165301.A18885@infradead.org \
--to=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox