From: Johan Rydberg <jrydberg@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: CD-ROM booting staus update
Date: Mon, 09 Jul 2007 13:56:51 +0200 [thread overview]
Message-ID: <87y7hpdc3g.fsf@gnu.org> (raw)
In-Reply-To: <8c0c43de0707032014k645ccb3ftfe9ab40637798481@mail.gmail.com> (Alex Roman's message of "Tue, 3 Jul 2007 23:14:40 -0400")
[-- Attachment #1: Type: text/plain, Size: 2975 bytes --]
"Alex Roman" <alex.roman@gmail.com> writes:
> I've cleaned up the code and created a patch which will enable allow
> booting from the first CD-ROM on a system. This is my first patch so I
> checked my code many times... hopefully it won't cause unwanted side
> effects, and hopefully my patch is in the correct format.
Hi Alex,
I haven't seen any reviews of this patch, so I'll give it a go.
Remember that I do not do any active GRUB2 development at the moment,
so I'll mostly comment on style related issues.
> + void EXPORT_FUNC(grub_eltorito_boot) (int drive, void *addr, int size) __attribute__ ((noreturn));
> +
If this line is longer than 72 characters, please try to break it.
> + /* We can't do this for CD drives */
> + if ( ! (drive & 0xe0) )
> + {
> + if (grub_biosdisk_get_diskinfo_standard (drive,
> + &data->cylinders,
> + &data->heads,
> + &data->sectors) != 0)
> + {
> + grub_free (data);
> + return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
> + }
> +
> + if (! total_sectors)
> + total_sectors = data->cylinders * data->heads * data->sectors;
> + }
I guess the outer braces are misaligned because of whitespace issues
(tab vs space)? Otherwise you need to indent them two steps further.
>
> disk->total_sectors = total_sectors;
> disk->data = data;
> @@ -167,20 +181,23 @@
> unsigned segment)
> {
> struct grub_biosdisk_data *data = disk->data;
> -
> +
Whitespace alterations. No need for those.
> - dap->block = sector;
> -
> + dap->block = sector;
> +
Same here.
> +/*
> + * Decode and print a Boot Record Volume Descriptor structure
> + */
Even though the license header in each file prefixes each line with a
star, we normally don't do that for other multiline comments.
> +/*
> + * The main command function
> + */
If you ask me, no need for this comment.
> +static grub_err_t
> +grub_cmd_eltorito (struct grub_arg_list *state __attribute__ ((unused)),
> + int argc __attribute__ ((unused)),
> + char **args __attribute__ ((unused)))
> +{
> + /* A few structure pointers that we'll need. */
> + grub_eltorito_boot_record_vol_descr brvd;
> + grub_eltorito_validation_entry ve;
> + grub_eltorito_default_entry de;
> +
> + /* Some other variables we'll need. */
> + grub_device_t cd_dev;
> + grub_disk_t disk;
> + grub_err_t err;
Instead of commenting that you have declared those variables, comment
WHY. If a comment is needed at all. The rule of thumb is to comment
why something is done, not how.
> +struct grub_eltorito_validation_entry_tag
> +{
> + // Header ID, must be 0x01.
> + grub_uint8_t header_id;
Please do not use C++ style single-line comments.
Besides these cosmetic comments I think the overall patch looks just
fine. Great work Alex.
~j
[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]
prev parent reply other threads:[~2007-07-09 11:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-27 1:36 CD-ROM booting staus update Alex Roman
2007-06-28 14:04 ` Alex Roman
2007-07-01 11:57 ` Robert Millan
2007-07-04 3:14 ` Alex Roman
2007-07-04 19:47 ` Uwe Hermann
2007-07-04 20:14 ` Alex Roman
2007-07-05 0:10 ` Alex Roman
2007-07-07 18:57 ` Robert Millan
2007-07-08 13:52 ` Alex Roman
2007-07-09 11:56 ` Johan Rydberg [this message]
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=87y7hpdc3g.fsf@gnu.org \
--to=jrydberg@gnu.org \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.