scripts/check_format.sh: catch misaligned comments

Fix up the existing comment blocks misaligned in the first column.

Also add line numbers to the comment checks.

Change-Id: I9d28c365271df36e7013d74cbb02d0023ab4f581
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-04-25 10:35:22 -07:00
parent 2a0d341f98
commit 5639b965ac
15 changed files with 181 additions and 203 deletions

View File

@ -184,15 +184,13 @@ struct spdk_scsi_dev {
}; };
/** /**
* \brief Represents a SCSI LUN.
\brief Represents a SCSI LUN. *
* LUN modules will implement the function pointers specifically for the LUN
LUN modules will implement the function pointers specifically for the LUN * type. For example, NVMe LUNs will implement scsi_execute to translate
type. For example, NVMe LUNs will implement scsi_execute to translate * the SCSI task to an NVMe command and post it to the NVMe controller.
the SCSI task to an NVMe command and post it to the NVMe controller. * malloc LUNs will implement scsi_execute to translate the SCSI task and
malloc LUNs will implement scsi_execute to translate the SCSI task and * copy the task's data into or out of the allocated memory buffer.
copy the task's data into or out of the allocated memory buffer.
*/ */
struct spdk_scsi_lun { struct spdk_scsi_lun {
/** LUN id for this logical unit. */ /** LUN id for this logical unit. */
@ -244,20 +242,18 @@ int spdk_scsi_dev_allocate_io_channels(struct spdk_scsi_dev *dev);
void spdk_scsi_dev_free_io_channels(struct spdk_scsi_dev *dev); void spdk_scsi_dev_free_io_channels(struct spdk_scsi_dev *dev);
/** /**
* \brief Constructs a SCSI device object using the given parameters.
\brief Constructs a SCSI device object using the given parameters. *
* \param name Name for the SCSI device.
\param name Name for the SCSI device. * \param queue_depth Queue depth for the SCSI device. This queue depth is
\param queue_depth Queue depth for the SCSI device. This queue depth is * a combined queue depth for all LUNs in the device.
a combined queue depth for all LUNs in the device. * \param lun_list List of LUN objects for the SCSI device. Caller is
\param lun_list List of LUN objects for the SCSI device. Caller is * responsible for managing the memory containing this list.
responsible for managing the memory containing this list. * \param lun_id_list List of LUN IDs for the LUN in this SCSI device. Caller is
\param lun_id_list List of LUN IDs for the LUN in this SCSI device. Caller is * responsible for managing the memory containing this list.
responsible for managing the memory containing this list. * lun_id_list[x] is the LUN ID for lun_list[x].
lun_id_list[x] is the LUN ID for lun_list[x]. * \param num_luns Number of entries in lun_list and lun_id_list.
\param num_luns Number of entries in lun_list and lun_id_list. * \return The constructed spdk_scsi_dev object.
\return The constructed spdk_scsi_dev object.
*/ */
struct spdk_scsi_dev *spdk_scsi_dev_construct(const char *name, struct spdk_scsi_dev *spdk_scsi_dev_construct(const char *name,
char *lun_name_list[], char *lun_name_list[],

View File

@ -51,37 +51,36 @@
#include "spdk/scsi_spec.h" #include "spdk/scsi_spec.h"
/** \page block_backend_modules Block Device Backend Modules /** \page block_backend_modules Block Device Backend Modules
*
To implement a backend block device driver, a number of functions * To implement a backend block device driver, a number of functions
dictated by struct spdk_bdev_fn_table must be provided. * dictated by struct spdk_bdev_fn_table must be provided.
*
The module should register itself using SPDK_BDEV_MODULE_REGISTER or * The module should register itself using SPDK_BDEV_MODULE_REGISTER or
SPDK_VBDEV_MODULE_REGISTER to define the parameters for the module. * SPDK_VBDEV_MODULE_REGISTER to define the parameters for the module.
*
Use SPDK_BDEV_MODULE_REGISTER for all block backends that are real disks. * Use SPDK_BDEV_MODULE_REGISTER for all block backends that are real disks.
Any virtual backends such as RAID, partitioning, etc. should use * Any virtual backends such as RAID, partitioning, etc. should use
SPDK_VBDEV_MODULE_REGISTER. * SPDK_VBDEV_MODULE_REGISTER.
*
<hr> * <hr>
*
In the module initialization code, the config file sections can be parsed to * In the module initialization code, the config file sections can be parsed to
acquire custom configuration parameters. For example, if the config file has * acquire custom configuration parameters. For example, if the config file has
a section such as below: * a section such as below:
<blockquote><pre> * <blockquote><pre>
[MyBE] * [MyBE]
MyParam 1234 * MyParam 1234
</pre></blockquote> * </pre></blockquote>
*
The value can be extracted as the example below: * The value can be extracted as the example below:
<blockquote><pre> * <blockquote><pre>
struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "MyBe"); * struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "MyBe");
int my_param = spdk_conf_section_get_intval(sp, "MyParam"); * int my_param = spdk_conf_section_get_intval(sp, "MyParam");
</pre></blockquote> * </pre></blockquote>
*
The backend initialization routine also need to create "disks". A virtual * The backend initialization routine also need to create "disks". A virtual
representation of each LUN must be constructed. Mainly a struct spdk_bdev * representation of each LUN must be constructed. Mainly a struct spdk_bdev
must be passed to the bdev database via spdk_bdev_register(). * must be passed to the bdev database via spdk_bdev_register().
*/ */
/** Block device module */ /** Block device module */

View File

@ -132,10 +132,6 @@ static void spdk_reactor_construct(struct spdk_reactor *w, uint32_t lcore,
static struct spdk_mempool *g_spdk_event_mempool[SPDK_MAX_SOCKET]; static struct spdk_mempool *g_spdk_event_mempool[SPDK_MAX_SOCKET];
/** \file
*/
static struct spdk_reactor * static struct spdk_reactor *
spdk_reactor_get(uint32_t lcore) spdk_reactor_get(uint32_t lcore)
{ {
@ -221,11 +217,10 @@ spdk_event_queue_run_batch(uint32_t lcore)
} }
/** /**
*
\brief Set current reactor thread name to "reactor <cpu #>". * \brief Set current reactor thread name to "reactor <cpu #>".
*
This makes the reactor threads distinguishable in top and gdb. * This makes the reactor threads distinguishable in top and gdb.
*/ */
static void set_reactor_thread_name(uint32_t lcore) static void set_reactor_thread_name(uint32_t lcore)
{ {
@ -277,25 +272,25 @@ _spdk_poller_unregister_complete(struct spdk_poller *poller)
} }
/** /**
*
\brief This is the main function of the reactor thread. * \brief This is the main function of the reactor thread.
*
\code * \code
*
while (1) * while (1)
if (events to run) * if (events to run)
dequeue and run a batch of events * dequeue and run a batch of events
*
if (active pollers) * if (active pollers)
run the first poller in the list and move it to the back * run the first poller in the list and move it to the back
*
if (first timer poller has expired) * if (first timer poller has expired)
run the first timer poller and reinsert it in the timer list * run the first timer poller and reinsert it in the timer list
*
if (idle for at least SPDK_REACTOR_SPIN_TIME_US) * if (idle for at least SPDK_REACTOR_SPIN_TIME_US)
sleep until next timer poller is scheduled to expire * sleep until next timer poller is scheduled to expire
\endcode * \endcode
*
*/ */
static int static int
_spdk_reactor_run(void *arg) _spdk_reactor_run(void *arg)

View File

@ -292,20 +292,18 @@ int spdk_initialize_iscsi_conns(void)
} }
/** /**
* \brief Create an iSCSI connection from the given parameters and schedule it
\brief Create an iSCSI connection from the given parameters and schedule it * on a reactor.
on a reactor. *
* \code
\code *
* # identify reactor where the new connections work item will be scheduled
# identify reactor where the new connections work item will be scheduled * reactor = spdk_iscsi_conn_allocate_reactor()
reactor = spdk_iscsi_conn_allocate_reactor() * allocate spdk_iscsi_conn object
allocate spdk_iscsi_conn object * initialize spdk_iscsi_conn object
initialize spdk_iscsi_conn object * schedule iSCSI connection work item on reactor
schedule iSCSI connection work item on reactor *
* \endcode
\endcode
*/ */
int int
spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
@ -811,20 +809,17 @@ spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match,
} }
/** /**
* \brief Reads data for the specified iSCSI connection from its TCP socket.
\brief Reads data for the specified iSCSI connection from its TCP socket. *
* The TCP socket is marked as non-blocking, so this function may not read
The TCP socket is marked as non-blocking, so this function may not read * all data requested.
all data requested. *
* Returns SPDK_ISCSI_CONNECTION_FATAL if the recv() operation indicates a fatal
Returns SPDK_ISCSI_CONNECTION_FATAL if the recv() operation indicates a fatal * error with the TCP connection (including if the TCP connection was closed
error with the TCP connection (including if the TCP connection was closed * unexpectedly.
unexpectedly. *
* Otherwise returns the number of bytes successfully read.
Otherwise returns the number of bytes successfully read.
*/ */
int int
spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes, spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
void *buf) void *buf)
@ -1016,23 +1011,21 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn)
} }
/** /**
* \brief Makes one attempt to flush response PDUs back to the initiator.
\brief Makes one attempt to flush response PDUs back to the initiator. *
* Builds a list of iovecs for response PDUs that must be sent back to the
Builds a list of iovecs for response PDUs that must be sent back to the * initiator and passes it to writev().
initiator and passes it to writev(). *
* Since the socket is non-blocking, writev() may not be able to flush all
Since the socket is non-blocking, writev() may not be able to flush all * of the iovecs, and may even partially flush one of the iovecs. In this
of the iovecs, and may even partially flush one of the iovecs. In this * case, the partially flushed PDU will remain on the write_pdu_list with
case, the partially flushed PDU will remain on the write_pdu_list with * an offset pointing to the next byte to be flushed.
an offset pointing to the next byte to be flushed. *
* Returns 0 if no exceptional error encountered. This includes cases where
Returns 0 if no exceptional error encountered. This includes cases where * there are no PDUs to flush or not all PDUs could be flushed.
there are no PDUs to flush or not all PDUs could be flushed. *
* Returns -1 if an exception error occurred indicating the TCP connection
Returns -1 if an exception error occurred indicating the TCP connection * should be closed.
should be closed.
*/ */
static int static int
spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn) spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
@ -1140,25 +1133,23 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
} }
/** /**
* \brief Flushes response PDUs back to the initiator.
\brief Flushes response PDUs back to the initiator. *
* This function may return without all PDUs having flushed to the
This function may return without all PDUs having flushed to the * underlying TCP socket buffer - for example, in the case where the
underlying TCP socket buffer - for example, in the case where the * socket buffer is already full.
socket buffer is already full. *
* During normal RUNNING connection state, if not all PDUs are flushed,
During normal RUNNING connection state, if not all PDUs are flushed, * then subsequent calls to this routine will eventually flush
then subsequent calls to this routine will eventually flush * remaining PDUs.
remaining PDUs. *
* During other connection states (EXITING or LOGGED_OUT), this
During other connection states (EXITING or LOGGED_OUT), this * function will spin until all PDUs have successfully been flushed.
function will spin until all PDUs have successfully been flushed. *
* Returns 0 for success.
Returns 0 for success. *
* Returns -1 for an exceptional error indicating the TCP connection
Returns -1 for an exceptional error indicating the TCP connection * should be closed.
should be closed.
*/ */
static int static int
spdk_iscsi_conn_flush_pdus(struct spdk_iscsi_conn *conn) spdk_iscsi_conn_flush_pdus(struct spdk_iscsi_conn *conn)
@ -1351,22 +1342,20 @@ spdk_iscsi_conn_full_feature_do_work(void *arg)
} }
/** /**
* \brief This is the main routine for the iSCSI 'idle' connection
\brief This is the main routine for the iSCSI 'idle' connection * work item.
work item. *
* This function handles processing of connecitons whose state have
This function handles processing of connecitons whose state have * been determined as 'idle' for lack of activity. These connections
been determined as 'idle' for lack of activity. These connections * no longer reside in the reactor's poller ring, instead they have
no longer reside in the reactor's poller ring, instead they have * been staged into an idle list. This function utilizes the use of
been staged into an idle list. This function utilizes the use of * epoll as a non-blocking means to test for new socket connection
epoll as a non-blocking means to test for new socket connection * events that indicate the connection should be moved back into the
events that indicate the connection should be moved back into the * active ring.
active ring. *
* While in the idle list, this function must scan these connections
While in the idle list, this function must scan these connections * to process required timer based actions that must be maintained
to process required timer based actions that must be maintained * even though the connection is considered 'idle'.
even though the connection is considered 'idle'.
*/ */
void spdk_iscsi_conn_idle_do_work(void *arg) void spdk_iscsi_conn_idle_do_work(void *arg)
{ {

View File

@ -282,15 +282,13 @@ static void spdk_scsi_lun_hot_remove(void *remove_ctx)
} }
/** /**
* \brief Constructs a new spdk_scsi_lun object based on the provided parameters.
\brief Constructs a new spdk_scsi_lun object based on the provided parameters. *
* \param name Name for the SCSI LUN.
\param name Name for the SCSI LUN. * \param blockdev Blockdev associated with this LUN
\param blockdev Blockdev associated with this LUN *
* \return NULL if blockdev == NULL
\return NULL if blockdev == NULL * \return pointer to the new spdk_scsi_lun object otherwise
\return pointer to the new spdk_scsi_lun object otherwise
*/ */
_spdk_scsi_lun * _spdk_scsi_lun *
spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev) spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev)

View File

@ -38,8 +38,9 @@ fi
echo -n "Checking comment style..." echo -n "Checking comment style..."
git grep -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true git grep --line-number -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true
git grep -e '[^ ][*]/' -- '*.[ch]' >> comment.log || true git grep --line-number -e '[^ ][*]/' -- '*.[ch]' >> comment.log || true
git grep --line-number -e '^[*]' -- '*.[ch]' >> comment.log || true
if [ -s comment.log ]; then if [ -s comment.log ]; then
echo " Incorrect comment formatting detected" echo " Incorrect comment formatting detected"