Patch from Bart Van Assche <bart.vanassche@gmail.com>:
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 23 May 2008 15:22:12 +0000 (15:22 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 23 May 2008 15:22:12 +0000 (15:22 +0000)
The patch below fixes the following checkpatch warning:
__func__ should be used instead of gcc specific __FUNCTION__

This patch has been tested as follows:
- Checked that make iscsi scst still works.
- Checked that after loading the scst module the kernel messages generated
  because of the shell command "echo all >/proc/scsi_tg/trace_level" still
  make sense. An example:
  [  646.408035] [5845]: scst: scst_proc_log_entry_write:346:Changed trace level for "scsi_tgt": old 0x80005f0e, new 0xffffffff
- Checked that the patch generated by generate-kernel-patch still applies
  cleanly to the 2.6.25.4 kernel, that the patched kernel still compiles,
  installs and boots and that the scst, iscsi-scst and ib_srpt modules still
  load (I performed rm -rf /lib/modules/2.6.25.4* before starting kernel
  compilation).

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@393 d57e44dd-8a1f-0410-8b47-8ef2f437770f

iscsi-scst/kernel/digest.c
iscsi-scst/usr/iscsi_adm.c
iscsi-scst/usr/iscsid.c
iscsi-scst/usr/isns.c
iscsi-scst/usr/target.c
scst/include/scst_debug.h
scst/src/scst_lib.c
scst/src/scst_main.c

index 84b981d..131ee39 100644 (file)
@@ -195,7 +195,7 @@ void digest_tx_data(struct iscsi_cmnd *cmnd)
        u32 offset;
 
        TRACE_DBG("%s:%d req %p, own_sg %d, sg %p, sgcnt %d cmnd %p, "
-               "own_sg %d, sg %p, sgcnt %d", __FUNCTION__, __LINE__,
+               "own_sg %d, sg %p, sgcnt %d", __func__, __LINE__,
                cmnd->parent_req, cmnd->parent_req->own_sg,
                cmnd->parent_req->sg, cmnd->parent_req->sg_cnt,
                cmnd, cmnd->own_sg, cmnd->sg, cmnd->sg_cnt);
index a1e4aff..8c154eb 100644 (file)
@@ -137,7 +137,7 @@ static int iscsid_request_send(int fd, struct iscsi_adm_req *req)
 
        if (ret != sizeof(*req)) {
                err = (ret < 0) ? -errno : -EIO;
-               fprintf(stderr, "%s %d %d %d\n", __FUNCTION__, __LINE__, ret,
+               fprintf(stderr, "%s %d %d %d\n", __func__, __LINE__, ret,
                        err);
        } else
                err = 0;
@@ -162,7 +162,7 @@ static int iscsid_response_recv(int fd, struct iscsi_adm_req *req)
 
        if (ret != sizeof(rsp) + sizeof(*req)) {
                err = (ret < 0) ? -errno : -EIO;
-               fprintf(stderr, "%s %d %d %d\n", __FUNCTION__, __LINE__, ret,
+               fprintf(stderr, "%s %d %d %d\n", __func__, __LINE__, ret,
                        err);
        } else
                err = rsp.err;
index 53a520c..b1f2192 100644 (file)
@@ -642,7 +642,7 @@ static void text_scan_text(struct connection *conn)
                        if (ss.ss_family == AF_INET6 && suppress_ip6) {
                                if (strstr(p, "::ffff:") != p) {
                                        log_error("%s, %s:%d.", __FILE__,
-                                                 __FUNCTION__, __LINE__);
+                                                 __func__, __LINE__);
                                        suppress_ip6 = 0;
                                } else
                                        addr += 7;
index 99cb4a7..014dd3c 100644 (file)
@@ -141,7 +141,7 @@ static int isns_connect(void)
                return -1;
        }
 
-       log_error("%s %d: new connection %d", __FUNCTION__, __LINE__, fd);
+       log_error("%s %d: new connection %d", __func__, __LINE__, fd);
 
        if (!strlen(eid)) {
                err = isns_get_ip(fd);
@@ -210,7 +210,7 @@ static int isns_scn_deregister(char *name)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 
        return 0;
 }
@@ -269,7 +269,7 @@ static int isns_scn_register(void)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 
        return 0;
 }
@@ -323,7 +323,7 @@ static int isns_attr_query(char *name)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 
        return 0;
 }
@@ -361,7 +361,7 @@ static int isns_deregister(void)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
        return 0;
 }
 
@@ -423,7 +423,7 @@ int isns_target_register(char *name)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 
        if (scn_listen_port)
                isns_scn_register();
@@ -493,7 +493,7 @@ int isns_target_deregister(char *name)
 
        err = write(isns_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 
        return 0;
 }
@@ -587,7 +587,7 @@ static int recv_pdu(int fd, struct isns_io *rx, struct isns_hdr *hdr)
        get_hdr_param(hdr, function, length, flags, transaction,        \
                      sequence)                                         \
        log_error("%s %d: unknown function %x %u %x %u %u",             \
-                 __FUNCTION__, __LINE__,                               \
+                 __func__, __LINE__,                           \
                  function, length, flags, transaction, sequence);      \
 }
 
@@ -644,28 +644,28 @@ static void qry_rsp_handle(struct isns_hdr *hdr)
        }
 
        log_error("%s %d: transaction not found %u",
-                 __FUNCTION__, __LINE__, transaction);
+                 __func__, __LINE__, transaction);
 
        return;
 found:
 
        if (status) {
                log_error("%s %d: error response %u",
-                         __FUNCTION__, __LINE__, status);
+                         __func__, __LINE__, status);
 
                goto free_qry_mgmt;
        }
 
        if (!strlen(mgmt->name)) {
                log_debug(1, "%s %d: skip %u",
-                         __FUNCTION__, __LINE__, transaction);
+                         __func__, __LINE__, transaction);
                goto free_qry_mgmt;
        }
 
        target = target_lookup_by_name(mgmt->name);
        if (!target) {
                log_error("%s %d: invalid tid %s",
-                         __FUNCTION__, __LINE__, mgmt->name);
+                         __func__, __LINE__, mgmt->name);
                goto free_qry_mgmt;
        }
 
@@ -684,7 +684,7 @@ found:
                        break;
                case ISNS_ATTR_ISCSI_NODE_TYPE:
                        if (ntohl(*(tlv->value)) == ISNS_NODE_INITIATOR && name) {
-                               log_error("%s %d: %s", __FUNCTION__, __LINE__,
+                               log_error("%s %d: %s", __func__, __LINE__,
                                          (char *) name);
                                ini = malloc(sizeof(*ini));
                                if (!ini)
@@ -723,7 +723,7 @@ int isns_handle(int is_timeout, int *timeout)
        if (err) {
                if (err == -EAGAIN)
                        return err;
-               log_debug(1, "%s %d: close connection %d", __FUNCTION__, __LINE__,
+               log_debug(1, "%s %d: close connection %d", __func__, __LINE__,
                          isns_fd);
                close(isns_fd);
                isns_fd = 0;
@@ -746,7 +746,7 @@ int isns_handle(int is_timeout, int *timeout)
        case ISNS_FUNC_SCN:
                name = print_scn_pdu(hdr);
                if (name) {
-                       log_error("%s %d: %s", __FUNCTION__, __LINE__, name);
+                       log_error("%s %d: %s", __func__, __LINE__, name);
                        isns_attr_query(name);
                }
                break;
@@ -766,7 +766,7 @@ static int scn_accept_connection(void)
        slen = sizeof(from);
        fd = accept(scn_listen_fd, (struct sockaddr *) &from, &slen);
        if (fd < 0) {
-               log_error("%s %d: accept error %s", __FUNCTION__, __LINE__,
+               log_error("%s %d: accept error %s", __func__, __LINE__,
                          strerror(errno));
                return -errno;
        }
@@ -774,7 +774,7 @@ static int scn_accept_connection(void)
 
        err = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
        if (err)
-               log_error("%s %d: %s\n", __FUNCTION__, __LINE__,
+               log_error("%s %d: %s\n", __func__, __LINE__,
                          strerror(errno));
        /* not critical, so ignore. */
 
@@ -804,7 +804,7 @@ static void send_scn_rsp(char *name, uint16_t transaction)
 
        err = write(scn_fd, buf, length + sizeof(struct isns_hdr));
        if (err < 0)
-               log_error("%s %d: %s", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s", __func__, __LINE__, strerror(errno));
 }
 
 int isns_scn_handle(int is_accept)
@@ -815,7 +815,7 @@ int isns_scn_handle(int is_accept)
        uint16_t function, length, flags, transaction, sequence;
        char *name = NULL;
 
-       log_error("%s %d: %d", __FUNCTION__, __LINE__, is_accept);
+       log_error("%s %d: %d", __func__, __LINE__, is_accept);
 
        if (is_accept)
                return scn_accept_connection();
@@ -824,7 +824,7 @@ int isns_scn_handle(int is_accept)
        if (err) {
                if (err == -EAGAIN)
                        return err;
-               log_debug(1, "%s %d: close connection %d", __FUNCTION__, __LINE__,
+               log_debug(1, "%s %d: close connection %d", __func__, __LINE__,
                          scn_fd);
                close(scn_fd);
                scn_fd = 0;
@@ -858,7 +858,7 @@ static int scn_init(char *addr)
 
        fd = socket(ss.ss_family, SOCK_STREAM, IPPROTO_TCP);
        if (fd < 0) {
-               log_error("%s %d: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s\n", __func__, __LINE__, strerror(errno));
                return -errno;
        }
 
@@ -866,21 +866,21 @@ static int scn_init(char *addr)
        if (ss.ss_family == AF_INET6) {
                err = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt));
                if (err)
-                       log_error("%s %d: %s\n", __FUNCTION__, __LINE__,
+                       log_error("%s %d: %s\n", __func__, __LINE__,
                                  strerror(errno));
                goto out;
        }
 
        err = listen(fd, 5);
        if (err) {
-               log_error("%s %d: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s\n", __func__, __LINE__, strerror(errno));
                goto out;
        }
 
        slen = sizeof(lss);
        err = getsockname(fd, (struct sockaddr *) &lss, &slen);
        if (err) {
-               log_error("%s %d: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+               log_error("%s %d: %s\n", __func__, __LINE__, strerror(errno));
                goto out;
        }
 
index e69eeef..f84664e 100644 (file)
@@ -96,7 +96,7 @@ int target_del(u32 tid)
        remque(&target->tlist);
 
        if (!list_empty(&target->sessions_list)) {
-               log_error("%s still have sessions %d\n", __FUNCTION__, tid);
+               log_error("%s still have sessions %d\n", __func__, tid);
                exit(-1);
        }
 
index 93bfc42..4d4fa48 100644 (file)
@@ -151,7 +151,7 @@ do {                                                                          \
        if (___unlikely(trace_flag & (trace))) {                          \
                char *__tflag = LOG_FLAG;                                 \
                if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX, \
-                                      __FUNCTION__, __LINE__) > 0) {     \
+                                      __func__, __LINE__) > 0) {         \
                        __tflag = NO_FLAG;                                \
                }                                                         \
                PRINT(NO_FLAG, "%s" format, __tflag, args);               \
@@ -168,7 +168,7 @@ do {                                                                \
 do {                                                                   \
        if (___unlikely(trace_flag & (flag))) {                         \
                char *__tflag = INFO_FLAG;                              \
-               if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
+               if (debug_print_prefix(trace_flag, __tflag, NULL, __func__,\
                                       __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
@@ -191,7 +191,7 @@ do {                                                                        \
 do {                                                                   \
        if (trace_flag & (trace)) {                                     \
                char *__tflag = LOG_FLAG;                               \
-               if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__,\
+               if (debug_print_prefix(trace_flag, __tflag, NULL, __func__,\
                                       __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
@@ -210,7 +210,7 @@ do {                                                                        \
 do {                                                                   \
        if (trace_flag & TRACE_BUFF) {                                  \
                char *__tflag = LOG_FLAG;                               \
-               if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
+               if (debug_print_prefix(trace_flag, __tflag, NULL, __func__, \
                                       __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
@@ -223,7 +223,7 @@ do {                                                                        \
 do {                                                                   \
        if (trace_flag & (flag)) {                                      \
                char *__tflag = LOG_FLAG;                               \
-               if (debug_print_prefix(trace_flag, __tflag, NULL, __FUNCTION__, \
+               if (debug_print_prefix(trace_flag, __tflag, NULL, __func__, \
                                       __LINE__) > 0) {                 \
                        __tflag = NO_FLAG;                              \
                }                                                       \
@@ -236,7 +236,7 @@ do {                                                                        \
 do {                                                                   \
        char *__tflag = log_flag;                                       \
        if (debug_print_prefix(trace_flag, __tflag, __LOG_PREFIX,       \
-                              __FUNCTION__, __LINE__) > 0) {           \
+                              __func__, __LINE__) > 0) {               \
                __tflag = NO_FLAG;                                      \
        }                                                               \
        PRINT(NO_FLAG, "%s" format, __tflag, args);                     \
@@ -272,10 +272,10 @@ do {                                                                      \
        if (trace_flag & TRACE_ENTRYEXIT) {                             \
                if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: ENTRY %s", current->pid, \
-                               __FUNCTION__);                          \
+                               __func__);                              \
                }                                                       \
                else {                                                  \
-                       PRINT(LOG_FLAG, "ENTRY %s", __FUNCTION__);      \
+                       PRINT(LOG_FLAG, "ENTRY %s", __func__);          \
                }                                                       \
        }                                                               \
 } while (0)
@@ -285,10 +285,10 @@ do {                                                                      \
        if (trace_flag & TRACE_ENTRYEXIT) {                             \
                if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s", current->pid,  \
-                               __FUNCTION__);                          \
+                               __func__);                              \
                }                                                       \
                else {                                                  \
-                       PRINT(LOG_FLAG, "EXIT %s", __FUNCTION__);       \
+                       PRINT(LOG_FLAG, "EXIT %s", __func__);           \
                }                                                       \
        }                                                               \
 } while (0)
@@ -298,10 +298,10 @@ do {                                                                      \
        if (trace_flag & TRACE_ENTRYEXIT) {                             \
                if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s: %ld", current->pid, \
-                               __FUNCTION__, (long)(res));             \
+                             __func__, (long)(res));                   \
                }                                                       \
                else {                                                  \
-                       PRINT(LOG_FLAG, "EXIT %s: %ld", __FUNCTION__, (long)(res)); \
+                       PRINT(LOG_FLAG, "EXIT %s: %ld", __func__, (long)(res)); \
                }                                                       \
        }                                                               \
 } while (0)
@@ -311,10 +311,10 @@ do {                                                                      \
        if (trace_flag & TRACE_ENTRYEXIT) {                             \
                if (trace_flag & TRACE_PID) {                           \
                        PRINT(LOG_FLAG, "[%d]: EXIT %s: 0x%lx", current->pid, \
-                               __FUNCTION__, (long)(res));             \
+                             __func__, (long)(res));                   \
                }                                                       \
                else {                                                  \
-                       PRINT(LOG_FLAG, "EXIT %s: %lx", __FUNCTION__, (long)(res)); \
+                       PRINT(LOG_FLAG, "EXIT %s: %lx", __func__, (long)(res)); \
                }                                                       \
        }                                                               \
 } while (0)
index 5925c30..147956c 100644 (file)
@@ -262,7 +262,7 @@ void scst_free_device(struct scst_device *dev)
        if (!list_empty(&dev->dev_tgt_dev_list) ||
            !list_empty(&dev->dev_acg_dev_list)) {
                PRINT_CRIT_ERROR("%s: dev_tgt_dev_list or dev_acg_dev_list "
-                       "is not empty!", __FUNCTION__);
+                       "is not empty!", __func__);
                sBUG();
        }
 #endif
@@ -354,7 +354,7 @@ int scst_destroy_acg(struct scst_acg *acg)
        TRACE_ENTRY();
 
        if (!list_empty(&acg->acg_sess_list)) {
-               PRINT_ERROR("%s: acg_sess_list is not empty!", __FUNCTION__);
+               PRINT_ERROR("%s: acg_sess_list is not empty!", __func__);
                res = -EBUSY;
                goto out;
        }
@@ -1341,7 +1341,7 @@ void scst_free_cmd(struct scst_cmd *cmd)
 
 #if defined(EXTRACHECKS) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
        if (cmd->scsi_req) {
-               PRINT_ERROR("%s: %s", __FUNCTION__, "Cmd with unfreed "
+               PRINT_ERROR("%s: %s", __func__, "Cmd with unfreed "
                        "scsi_req!");
                scst_release_request(cmd);
        }
@@ -2193,7 +2193,7 @@ int scst_block_generic_dev_done(struct scst_cmd *cmd,
                        buffer_size = scst_get_buf_first(cmd, &buffer);
                        if (unlikely(buffer_size <= 0)) {
                                PRINT_ERROR("%s: Unable to get the buffer "
-                                       "(%d)", __FUNCTION__, buffer_size);
+                                       "(%d)", __func__, buffer_size);
                                goto out;
                        }
 
@@ -2245,7 +2245,7 @@ int scst_tape_generic_dev_done(struct scst_cmd *cmd,
                buffer_size = scst_get_buf_first(cmd, &buffer);
                if (unlikely(buffer_size <= 0)) {
                        PRINT_ERROR("%s: Unable to get the buffer (%d)",
-                               __FUNCTION__, buffer_size);
+                               __func__, buffer_size);
                        goto out;
                }
                break;
index a98d940..289c3b2 100644 (file)
@@ -644,13 +644,13 @@ int scst_register_virtual_device(struct scst_dev_type *dev_handler,
 
        if (dev_handler == NULL) {
                PRINT_ERROR("%s: valid device handler must be supplied",
-                       __FUNCTION__);
+                           __func__);
                res = -EINVAL;
                goto out;
        }
 
        if (dev_name == NULL) {
-               PRINT_ERROR("%s: device name must be non-NULL", __FUNCTION__);
+               PRINT_ERROR("%s: device name must be non-NULL", __func__);
                res = -EINVAL;
                goto out;
        }